home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
jaz_clib.arc
/
INDEX.C
< prev
next >
Wrap
Text File
|
1989-04-09
|
746b
|
26 lines
/*
┌────────────────────────────────────────────────────────────────────────────┐
│index.c │
│Return the index (pos) of a char in a string or -1 if not found │
│Usage: │
│ int result; │
│ │
│ if ( (result = index("filename.ext",'.')) == -1) │
│ printf("No extension was specified"); │
│ │
│ (C) JazSoft Software by Jack A. Zucker (301) 794-5950 │
└────────────────────────────────────────────────────────────────────────────┘
*/
index(s,c)
char *s,c;
{
unsigned int i = (unsigned int) s + 1;
while (*s)
if (*s++ == c)
return((unsigned int) s - i);
return(-1);
}